#ifndef POLYNOMIAL_H
#define POLYNOMIAL_H
#include <cstdarg>

class polynomial
{
public:         // Constructors/Destructors
    /**
     * Empty Constructor
     */
    polynomial();

    /**
     * Constructor
     */
    polynomial(int order, ...);

    /**
     * Empty Destructor
     */
    virtual ~polynomial ( );

public:         // Public general methods
    /**
     * Solve two polynomials ...
     */
    double solveForConst(polynomial* p1, polynomial* p2);

protected:      // Protected methods
private:        // Private attribute accessor methods
private:        // Other private functions

    /**
     * Initialization function of class variables.
     */
    void initAttributes ( ) ;

    /**
     * Multiplies base by desending factorial for n levels
     * @return product
     * @param base is the starting number
     * @param n is the number of times the base will be multiplied
     */
    int truncFactorial(int base, int n);

private:        // Static Private attributes
private:        // Private attributes

    int m_order;            // Order of the production curve from form:
                            //  [1] + [2]*P^1 + [3]*P^2 + [4]*P^3 + [5]*P^4 + [6]*P^5...
    float* m_constants;     // Ptr to equation constants from form:
                            //  [1] + [2]*P^1 + [3]*P^2 + [4]*P^3 + [5]*P^4 + [6]*P^5...
    float* m_constants1DRV; // Ptr to 1st derivative of the equation constants from form:
                            //  [2] + 2*[3]*P + 3*[4]*P^2 + 4*[5]*P^3 + 5*[6]*P^4...
    float* m_constants2DRV; // Ptr to 2nd derivative of the equation constants from form:
                            //  2*[3] + 6*[4]*P + 12*[5]*P^2 + 20*[6]*P^3...
    float* m_constants3DRV; // Ptr to 3rd derivative of the equation constants from form:
                            //  6*[4] + 24*[5]*P + 60*[6]*P^2...
};

#endif // POLYNOMIAL_H
